﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Ccit.Utils;
using System.Collections.Generic;

namespace Ccit.OA.NewsCenter
{
    public class WindowBLL
    {
        #region
        /// <summary>
        /// 获取窗口列表信息
        /// </summary>
        /// <returns></returns>
        public List<MsWinStyle> GetWindowList(string winName,string Type)
        {
            IWindow window = GetBllObj();
            List<MsWinStyle> winList = window.GetWindowList(winName,Type);
            window = null;
            return winList;
        }
        /// <summary>
        /// 删除操作
        /// </summary>
        /// <param name="plateId">板块ID</param>
        /// <returns></returns>
        public List<string> RemoveWinStyle(string plateId,string Type)
        {
            IWindow window = GetBllObj();
            List<string> slist = window.RemoveWinStyle(plateId,Type);
            window = null;
            return slist;
        }
        /// <summary>
        /// 获取单个对象
        /// </summary>
        /// <param name="plateId">NEWS_B2_10</param>
        /// <returns></returns>
        public MsWinStyle GetWinStyleObj(string plateId,string Type)
        {
            IWindow window = GetBllObj();
            MsWinStyle winObj = window.GetWinStyleObj(plateId,Type);
            window = null;
            return winObj;
        }

        /// <summary>
        /// 获取系统板块的属性对象
        /// </summary>
        /// <param name="plateId"></param>
        /// <param name="Type"></param>
        /// <param name="vUserId"></param>
        /// <returns></returns>
        public MsWinStyle GetWinDefault(string plateId, string Type, string vUserId)
        {
            IWindow window = GetBllObj();
            MsWinStyle winObj = window.GetWinDefault(plateId, Type, vUserId);
            window = null;
            return winObj;
        }
        /// <summary>
        /// 保存板块信息
        /// </summary>
        /// <param name="winObj"></param>
        /// <returns></returns>
        public List<string> SaveWinStyle(MsWinStyle winObj, MsQueryClause queryClause,string Type)
        {
            IWindow window = GetBllObj();
            List<string> slist = window.SaveWinStyle(winObj,queryClause,Type);
            window = null;
            return slist;
        }


        /// <summary>
        /// 获取知道列的板块信息
        /// </summary>
        /// <param name="cellNum"></param>
        /// <returns></returns>
        public List<MsWinStyle> GetWinShowCell(string cellNum,string Type)
        {
            IWindow window = GetBllObj();
            List<MsWinStyle> winList = window.GetWinShowCell(cellNum,Type);
            window = null;
            return winList;
        }
         /// <summary>
        /// 获取系统板块的已选板块
        /// </summary>
        /// <param name="cellNum"></param>
        /// <param name="Type"></param>
        /// <returns></returns>
        public List<MsWinStyle> GetSysWinShowCell(string cellNum, string Type)
        {
            IWindow window = GetBllObj();
            List<MsWinStyle> winList = window.GetSysWinShowCell(cellNum, Type);
            window = null;
            return winList;
        }
        
        /// <summary>
        /// 获取未选择的板块
        /// </summary>
        /// <returns></returns>
        public List<MsWinStyle> GetUnSelPlate(string Type)
        {
            IWindow window = GetBllObj();
            List<MsWinStyle> winList = window.GetUnSelPlate(Type);
            window = null;
            return winList;
        }

        /// <summary>
        /// 获取系统板块的待选板块
        /// </summary>
        /// <param name="Type"></param>
        /// <returns></returns>
        public List<MsWinStyle> GetSysUnSelPlate(string Type)
        {
            IWindow window = GetBllObj();
            List<MsWinStyle> winList = window.GetSysUnSelPlate(Type);
            window = null;
            return winList;
        }

        /// <summary>
        /// 编辑板块对象
        /// </summary>
        /// <param name="winObj"></param>
        /// <returns></returns>
        public List<string> ModifyWinStyleObj(MsWinStyle winObj,string Type,string vUserId)
        {
            IWindow window = GetBllObj();
            List<string> strlist = window.ModifyWinStyleObj(winObj,Type,vUserId);
            window = null;
            return strlist;
        }

        /// <summary>
        /// 获取创建信息的用户
        /// </summary>
        /// <param name="newsId"></param>
        /// <returns></returns>
        public string GetUserId(string newsId)
        {
            IWindow window = GetBllObj();
            string sResult = window.GetUserId(newsId);
            return sResult;
        }

        /// <summary>
        /// 获取创建信息的时间
        /// </summary>
        /// <param name="newsId"></param>
        /// <returns></returns>
        public string GetPubDate(string newsId)
        {
            IWindow window = GetBllObj();
            string sResult = window.GetPubDate(newsId);
            return sResult;
        }
        /// <summary>
        /// 获取新用户的默认板块
        /// </summary>
        /// <param name="cellNum"></param>
        /// <param name="Type"></param>
        /// <returns></returns>
        public List<MsWinStyle> GetDefaultWin(string cellNum, string Type)
        {
            IWindow window = GetBllObj();
            List<MsWinStyle> lstWinStyle = window.GetDefaultWin(cellNum, Type);
            window = null;
            return lstWinStyle;
        }

        #endregion

        private IWindow GetBllObj()
        {
            IWindow window = (IWindow)Factory.CreateObject("Ccit.OA.NewsCenter.dll", "Ccit.OA.NewsCenter.Window", ImportComponentType.DotNetDll, null);
            return window;
        }
    }
}
